<!DOCTYPE html>
<html lang="en">
<head>
    <script>
        if(!localStorage.forgetTel||localStorage.yzmRight!="true"){
            location = "wangji.html";
        }
    </script>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon"
    href="https://static.app.yinxiang.com/embedded-web/registration/favicon.ico"/>
    <link rel="stylesheet" href="css/wangji.css">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/reg.css"> 
    <title>重设密码</title>
</head>
<body>
    <div class="wangjidiv">
        <div class="header">
            <a href="login.html" class="wangjilogo"></aa>
            <a href="login.html" class="denglubtn">登录</a>
        </div>
        <div class="wangjiinput">
            <div><h1 style="font-weight: normal;margin-left: 5%; padding: 20px 0;">设置你新的密码</h1></div>
            <div class="line"></div>
            <div class="clearfix">
                <div class="shuoming fl">
                    请输入新的密码
                </div>
                <div class="right">
                    <div class="shuoming">新密码</div>
                    <div><input id="newpwd1" placeholder="请设置密码，至少6位字符" type="password"></div>
                    <div class="error error1" id="error1"></div>
                    <div class="shuoming">确认新密码</div>
                    <div><input id="newpwd2" placeholder="请再次输入密码，与上面一致" type="password"></div>
                    <div class="error error2" id="error2"></div>
                    <div class="shuomingbtn3 btn" id="shuomingbtn3">重设密码</div>
                </div>
            </div>
            <div style="text-align: center;font-size:14px" id="tip"></div>
        </div>
        <div class="shuoming" style="text-align: center;"><a href="">服务条款</a> | <a href="">隐私政策</a> | 版权所有 2007-2020 大象笔记, 保留所有权利。</div>
    </div>

    <script src="https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/js/lib/jquery-1-cc52697ab1.10.2.js"></script>
    <script src="js/base.js"></script>
    
    <script>

    shuomingbtn3.onclick = function(){
        var newpwd1Value = newpwd1.value;
        var newpwd2Value = newpwd2.value;
        var newpwd1Right = false;
        var newpwd2Right = false;

        if(newpwd1Value.length == 0){
            error1.innerHTML = "密码不能为空";
            newpwd1Right = false;
        }else if(newpwd1Value.length < 6){
            error1.innerHTML = "密码至少6位，支持数字、字母和符号";
            newpwd1Right = false;
        }else if(newpwd1Value.length < 8){
            error1.innerHTML = "强度高的密码至少需要8个字符，同时包含大小写字母、数字和符号";
            error1.className = "warn";
            newpwd1.className = "warnbg";
            isWarn = true;
            newpwd1Right = true;
        }else{
            error1.innerHTML = "";
            newpwd1Right = true;
        }


        if(newpwd1Value == newpwd2Value&&newpwd1Right){
            ajax("/bijiuser/resetpwd",{tel:localStorage.forgetTel,pwd:newpwd1.value},
            function(data){
            if(data=="修改成功"){
                location = "login.html";
            }else{
                tip.innerHTML = data;
            } 
        })
        }else{
            error2.innerHTML = "两次密码应输入一致！";
        }

        
        };
        </script>
</body>
</html>